package cn.edu.sptc.luojie.hellespring.bean;

import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Slf4j
@Component

public class Triangle {
    //属性
    private int a;
    private int b;
    private int c;



    public boolean isTriangle(){
        return (a+b>c)&& (c+b>a)&& (a+c>b);
    }

    public  double getArea() {
        if (isTriangle()) {
            double s = (double) (a + b + c) / 2;
            return Math.sqrt(s * (s - a) * (s - b) * (s - c));
        }
        return 0.0;
    }
}
